#include "texture.h"
#include "graphicsmanager.h"

using std::string;
using namespace EPOC;

Texture::Texture(GraphicsManager *pGraphicsManager)
{
	SetClassID(kCLASSID_TEXTURE);

	m_pGraphicsManager = pGraphicsManager;
	m_sFilePath = "";
	m_bExclusive = false;
	SetSDLSurface(NULL);
	SetDimension(0, 0);
}

Texture::Texture()
{
	SetClassID(kCLASSID_TEXTURE);

	m_pGraphicsManager = NULL;
	m_sFilePath = "";
	m_sName = "";
	m_bExclusive = false;
	SetSDLSurface(NULL);
}

Texture::~Texture()
{
	Texture::Cleanup();
}

void Texture::Cleanup()
{
	////fprintf(stdout, "Debug - Texture::Cleanup(): Cleaning up Texture: %s \n", m_sFilePath);

	if(m_pSDLSurface)
		SDL_FreeSurface(m_pSDLSurface);
	m_pSDLSurface = NULL;

	if(m_pGraphicsManager)
		m_pGraphicsManager->RemoveTexture(this);

	m_sFilePath = "";
	m_sName = "";
}

bool Texture::Initialize(string sName, string sFilePath, bool bExclusive)
{
	m_sName = sName;
	m_sFilePath = sFilePath;
	m_bExclusive = bExclusive;

	return true;
}

bool Texture::Initialize(string sName, bool bExclusive)
{
	m_sName = sName;
	m_sFilePath = "";
	m_bExclusive = bExclusive;

	return true;
}